﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
using System.Globalization;
using PresentationLayer.Reports;




namespace PresentationLayer.View.Reports
{
    public partial class Report_TrendAnalysisByCategory : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            DS_Category ds = new DS_Category();
            PresentationLayer.Reports.DS_CategoryTableAdapters.CategoryTableAdapter ta = new PresentationLayer.Reports.DS_CategoryTableAdapters.CategoryTableAdapter();
            int m1 = Int32.Parse(DropDownList2.SelectedValue);
            string cat = DropDownList1.SelectedValue;

            if (m1 == 01)
            {
                ta.FillByJan(ds.Category,cat);
                PresentationLayer.Reports.Report_TrendAnalysisByCategory req = new PresentationLayer.Reports.Report_TrendAnalysisByCategory();
                req.SetDataSource(ds);
                CrystalReportViewer1.ReportSource = req;

            }
            if (m1 == 02)
            {
                ta.FillByfeb(ds.Category, cat);
                PresentationLayer.Reports.Report_TrendAnalysisByCategory req = new PresentationLayer.Reports.Report_TrendAnalysisByCategory();
                req.SetDataSource(ds);
                CrystalReportViewer1.ReportSource = req;

            }
            else 
            {
                ta.FillByALL(ds.Category, m1, cat);
                PresentationLayer.Reports.Report_TrendAnalysisByCategory req = new PresentationLayer.Reports.Report_TrendAnalysisByCategory();
                req.SetDataSource(ds);
                CrystalReportViewer1.ReportSource = req;
            
            }
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            string m1 = DropDownList2.SelectedItem.Value;
            string cat = DropDownList1.SelectedItem.Value;
            Response.Redirect("Print_TrendByCategory.aspx?m1="+m1+"&m2="+"&cat="+cat);
            
        }
    }
}